import { ref, computed } from "vue";
import { defineStore } from "pinia";

export const useUserStore = defineStore("counter", () => {
  //表示用户是否登录
  const userState = ref(window.localStorage.getItem('userState') === 'true')
  function setUserState(val){
    userState.value = val
  }  


   //存储用户id
   const userId = ref(window.localStorage.getItem('userid') || '')
   function setUserId(id){
     userId.value = id
   }
 

  return { 
    setUserState, 
    userState ,
    userId,
    setUserId
};
});
